Visualization with HoloViz
Imports
import uxarray as ux
import holoviews as hv
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import hvplot.pandas
# Create blue color theme
cmap = matplotlib.colors.LinearSegmentedColormap.from_list("Color_Theme", plt.cm.Blues(np.linspace(0.2, 1, 30)))
ds_file_480 = "../meshfiles/oQU480.230422.nc"
ds_file_120 = "../meshfiles/oQU120.230424.nc"
uxds_480 = ux.open_dataset(ds_file_480, ds_file_480)
uxds_120 = ux.open_dataset(ds_file_120, ds_file_120)
Visualizing Grid Geometry
gdf_480_grid = uxds_480.uxgrid.to_geodataframe()
gdf_120_grid = uxds_120.uxgrid.to_geodataframe()
Nodes
hv.extension("matplotlib")
plot_kwargs = {"size": 5.0, "xlabel": "Longitude", "ylabel": "Latitude", "xlim": (-110, -50), "ylim": (0, 40),
"coastline": True, "width": 800}
hv.Layout(gdf_480_grid.hvplot.points(**plot_kwargs) + gdf_120_grid.hvplot.points(**plot_kwargs)).opts(fig_size=300).cols(1)
/usr/share/miniconda3/envs/cookbook-dev/lib/python3.10/site-packages/cartopy/io/__init__.py:241: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_coastline.zip
warnings.warn(f'Downloading: {url}', DownloadWarning)
hv.extension("bokeh")
plot_kwargs = {"s": 4.0, "xlabel": "Longitude", "ylabel": "Latitude", "xlim": (-110, -50), "ylim": (0, 40),
"coastline": True}
hv.Layout(gdf_480_grid.hvplot.points(**plot_kwargs) + gdf_120_grid.hvplot.points(**plot_kwargs)).cols(1)
Edges
hv.extension("matplotlib")
plot_kwargs = {"linewidth": 0.5, "xlabel":" Longitude", "ylabel": "Latitude", "xlim": (-110, -50), "ylim": (0, 40),
"coastline": True, "width": 1600}
hv.Layout(gdf_480_grid.hvplot.paths(**plot_kwargs) + gdf_120_grid.hvplot.paths(**plot_kwargs)).opts(fig_size=300).cols(1)
hv.extension("bokeh")
plot_kwargs = {"line_width": 0.5, "xlabel": "Longitude", "ylabel": "Latitude", "xlim": (-110, -50), "ylim": (0, 40),
"coastline": True}
hv.Layout(gdf_480_grid.hvplot.paths(**plot_kwargs) + gdf_120_grid.hvplot.paths(**plot_kwargs)).cols(1)